<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
    <script type="text/javascript">
        const p = new Promise((resolve, reject) => {
            resolve('OK');
        });

        // (1)	简单表达: 由 then()指定的回调函数执行的结果决定
        let res = p.then((val) => {
            // console.log(val);
            // 1.抛出异常
            // throw '出了问题';
            // 2.返回结果是非promise对象
            // return 521;
            // 3.返回结果是promise对象
            return new Promise((resolve, reject) => {
                resolve("OK");
            });
        }, (err) => {
            console.warn(err);
        });

        console.log(res);
    </script>
</body>
</html>